package com.hoapital.outpbillwork.function.setValue;

import com.hospital.common.core.hl7Model.fields.*;
import com.hospital.common.core.hl7Model.messages.ORC;
import com.hoapital.outpbillwork.module.entity.OutpDoctorPrescMaster;

import java.text.SimpleDateFormat;

/**
 * @author lvyao
 * @description 处方信息设置
 * @date 2022/6/21
 */
public class SetPrescHl7Value extends SetCommSegmentsValue {
    public static ORC getORC(OutpDoctorPrescMaster outpDoctorPrescMaster, String hosCode, String hosName, String orc1, String orc5,String deptName){
        ORC orc = new ORC();
//        orc.setORC_1("NW");
        orc.setORC_1(orc1);
        EI orc_2 = new EI();
        orc_2.setEI_1(String.valueOf(outpDoctorPrescMaster.getVisitNo()));
        orc_2.setEI_2("");
        orc_2.setEI_3("");
        orc_2.setEI_4("");
        orc.setORC_2(orc_2);
        EI orc_3 = new EI();
        orc_3.setEI_1("");
        orc_3.setEI_2("");
        orc_3.setEI_3("");
        orc_3.setEI_4("");
        orc.setORC_3(orc_3);
        EI orc_4 = new EI();
        orc_4.setEI_1("");
        orc_4.setEI_2("");
        orc_4.setEI_3("");
        orc_4.setEI_4("");
        orc.setORC_4(orc_4);
//        orc.setORC_5("SC");
        orc.setORC_5(orc5);
        orc.setORC_6("");
        TQ orc_7 = new TQ();
        CQ orc_7_1 = new CQ();
        orc_7.setTQ_1(orc_7_1);
        RI orc_7_2 = new RI();
        orc_7.setTQ_2(orc_7_2);
        orc_7.setTQ_3("");
        orc_7.setTQ_4("");
        orc_7.setTQ_5("");
        orc_7.setTQ_6("");
        orc_7.setTQ_7("");
        orc_7.setTQ_8("");
        orc_7.setTQ_9("");
        orc_7.setTQ_10(new OSD());
        orc.setORC_7(orc_7);
        EIP orc_8 = new EIP();
        EI orc_8_1 = new EI();
        orc_8_1.setEI_1("");
        orc_8_1.setEI_2("");
        orc_8_1.setEI_3("");
        orc_8_1.setEI_4("");
        orc_8.setEIP_1(orc_8_1);
        EI orc_8_2 = new EI();
        orc_8_2.setEI_1("");
        orc_8_2.setEI_2("");
        orc_8_2.setEI_3("");
        orc_8_2.setEI_4("");
        orc_8.setEIP_2(orc_8_2);
        orc.setORC_8(orc_8);
        orc.setORC_9("");
        XCN orc_10 = new XCN() ;
        orc_10.setXCN_1("");
        orc_10.setXCN_2(new FN());
        orc_10.setXCN_3("");
        orc_10.setXCN_4("");
        orc_10.setXCN_5("");
        orc_10.setXCN_6("");
        orc.setORC_10(orc_10);
        XCN orc_11 = new XCN() ;
        orc_11.setXCN_1(String.valueOf(outpDoctorPrescMaster.getVerifyFlag()));
        orc_11.setXCN_2(new FN());
        orc_11.setXCN_3("");
        orc_11.setXCN_4("");
        orc_11.setXCN_5("");
        orc_11.setXCN_6("");
        orc.setORC_11(orc_11);
        XCN orc_12 = new XCN();
        orc_12.setXCN_1("");
        FN orc_12_2 = new FN();
        orc_12_2.setFN_1(outpDoctorPrescMaster.getPrescriber());
        orc_12.setXCN_2(orc_12_2);
        orc_12.setXCN_3("");
        orc_12.setXCN_4("");
        orc_12.setXCN_5("");
        orc_12.setXCN_6("");
        orc.setORC_12(orc_12);
        PL orc_13 = new PL();
        orc_13.setPL_1("");
        orc_13.setPL_2("");
        orc_13.setPL_3("");
        HD orc_13_4 = new HD();
        orc_13_4.setHD_1(outpDoctorPrescMaster.getOrderedBy());
        orc_13_4.setHD_2(deptName);
        orc_13.setPL_4(orc_13_4);
        orc_13.setPL_5("");
        orc_13.setPL_6("");
        orc_13.setPL_7("");
        orc_13.setPL_8("");
        orc_13.setPL_9("");
        orc.setORC_13(orc_13);
        orc.setORC_14(new XTN());
        orc.setORC_15(new SimpleDateFormat("yyyyMMddHHmmss").format(outpDoctorPrescMaster.getVisitDate()));
        CE orc_16 =new CE();
        orc_16.setCE_1(String.valueOf(outpDoctorPrescMaster.getChargeFlag()));
        orc_16.setCE_2("");
        orc_16.setCE_3("");
        orc_16.setCE_4("");
        orc_16.setCE_5("");
        orc_16.setCE_6("");
        orc.setORC_16(orc_16);
        orc.setORC_17(new CE());
        CE orc_18 = new CE();
        orc_18.setCE_1("");
        orc_18.setCE_2("");
        orc.setORC_18(orc_18);
        orc.setORC_19(new XCN());
        orc.setORC_20(new CE());
        XON orc_21 = new XON();
        orc_21.setXON_1(hosCode);
        orc_21.setXON_2(hosName);
        orc.setORC_21(orc_21);
        return orc;
    }
}
